from lxml import etree


def get_que_types(file_path):
    """
    把所有问题类型找出来
    :param file_path:
    :return:
    """
    # 加载文件内容
    with open(file_path, 'r', encoding='utf-8') as f:
        page = etree.HTML(f.read())
    # 找到所有问题框
    que_boxs = page.xpath('//*[contains(@class, "que ")]')
    que_types = []
    for que_box in que_boxs:
        class_info = que_box.xpath('@class')[0]  # 'que multianswer deferredfeedback correct'
        que_type = class_info.split()[1]
        que_types.append(que_type)
    print(set(que_types))  # {'multichoiceset', 'shortanswer', 'multichoice', 'truefalse', 'multianswer', 'gapselect'}
